<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html
	class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg no-smil svgclippaths">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>XToolsCRM-入库单</title>

<link href="../css/zcss/icons.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/pages.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/responsive.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/sweetalert.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/custombox.min.css" rel="stylesheet">
<link href="../css/zcss/animate.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/css.css" rel="stylesheet" type="text/css">

<link href="../css/zcss/bootstrap-datepicker3.min.css" rel="stylesheet">
<link href="../css/zcss/switchery.min.css" rel="stylesheet">
<link href="../css/zcss/bootstrap-clockpicker.min.css" rel="stylesheet">
<link href="../css/zcss/bootstrap-table.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/bootstrap.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/bootstrap-select.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/core.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/components.css" rel="stylesheet" type="text/css">

<!--图标的外部样式-->
<link href="http://cdn.xtcrm.com/cdn//v7/fm/ub/css/icons.css"
	rel="stylesheet" type="text/css">
<!--图标的外部样式-->

<link href="../css/zcss/pages.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/responsive.css" rel="stylesheet" type="text/css">
<link href="../css/zcss/sweetalert.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/custombox.min.css" rel="stylesheet">
<link href="../css/zcss/animate.min.css" rel="stylesheet"
	type="text/css">
<link href="../css/zcss/css.css" rel="stylesheet" type="text/css">


<script src="http://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet"
	href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script type="text/javascript" src="../js/axios.js"></script>
<script type="text/javascript" src="../js/qs.js"></script>



<script type="text/javascript" src="js/jquery-3.1.0.js"></script>
<script type="text/javascript">
			$(function() {
				$(".doings").click(
						function() {
							//点击了编辑明细按钮
						//alert("sdadas"+$(this).parent().next().attr("title"));
						$(this).parent().next().css('display','');
						$(this).parent().parent().next().css('display','');
						//$(this).parent().parent().next().next().css('display','');
						$(this).parent().css('display','none');
						});
				
				
				$(".stops").click(
						function() {
							//点击了取消编辑明细按钮
						//alert("sdadas"+$(this).parent().next().attr("title"));
						$(this).parent().prev().css('display','');
						$(this).parent().css('display','none');
						$(this).parent().parent().next().css('display','none');
						//$(this).parent().parent().next().next().css('display','none');
						});
				
				$(".giveItem").click(
					function() {
							//点击了取消编辑明细按钮
						var quatitys=$(this).parent().parent().next().find(".quatitys").val();
						var desctext=$(this).parent().parent().next().find(".desctext").val();
						var gidse=$(this).parent().parent().next().find(".gidse").val();
						var idse=$(this).parent().parent().next().find(".idse").val();
						//alert("第二个："+$(this).parent().parent().next().attr("title")+" quatitys:"+quatitys+" desctext"+desctext+" gidse"+gidse+" idse"+idse);
						
						// alert(tts);
						 $.post("/updateDetailQuandt?quatitys="+quatitys+"&desctext="
								 +desctext+"&gidse="+gidse+"&idse="+idse + "", {}, function(data) {
									// alert(data);
									window.location.href="/instockesdetail?ids="+data;
							

						});  
						
					});

			});
			
			
			
		</script>



</head>

<body onload=";">

	<div class="createOrderbox">

		<div class="enlarged forced" id="wrapper" style="height: auto;">
			<div class="content m-20">
				<div class="container-fluid">

					<div id="cname"></div>
					<div id="qshow" style="z-index: 0">

						<div class="portlet form-horizontal border-n">
							<div class="portlet-heading portlet-default">
								<div class="pull-right  f-s-12">
									<button class="btn btn-white waves-effect waves-light"
										onclick='qshow_click_del(52,"libin","77ed22");return false;'>
										<i class="fa fa-trash-o m-r-5"></i>删除
									</button>
									&nbsp;
									<!--<span class="button_close_qshow"><button class=" btn btn-default waves-effect waves-light m-r-5" data-dismiss="modal" aria-hidden="true"><i class="fa fa-close m-r-5"></i>关闭</button></span>-->

								</div>
								<h4 class="modal-title text-dark">
									<span set-lan="html:入库单">入库单</span> <a title=""
										href="/system/viewlog.xt?dtname=libin&amp;id=52&amp;mdb=fe72bbcc2ec1baccbb334706f08f4c76"
										target="_blank" data-toggle="tooltip"
										data-original-title="数据日志" data-placement="bottom"><i
										class="fa fa-bars m-r-5"></i></a>
								</h4>
								<hr class="border-t-a">

							</div>
							<div class="gedit_scroll_content">
								<div class="panel-collapse collapse in" id="bg-default">
									<div class="portlet-body p-t-0 p-r-7 show-box">
										<div class="row">
											<div class="col-md-12">
												<div class="form-group ">
													<label class="control-label col-md-2">主题:</label>
													<div class="form-control  col-md-10">{{ruleForm.titles}}</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">仓库:</label>
													<div class="form-control  col-md-8">{{ruleForm.deport}}</div>
												</div>
											</div>
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">填单时间:</label>
													<div class="form-control  col-md-8">{{ruleForm.havetime}}</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">状态:</label>
													<div class="form-control  col-md-8">{{ruleForm.types}}</div>
												</div>
											</div>
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">填单人:</label>
													<div class="form-control  col-md-8">{{ruleForm.domans}}</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">库管确认:</label>
														<div v-if="ruleForm.intype==3021" class="form-control  col-md-8">已确认</div>
													
												</div>
											</div>
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">执行时间:</label>
													<div class="form-control  col-md-8">{{ruleForm.dodate}}</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">对应采购单:</label>
													<div class="form-control  col-md-8">

														<c:if test="${ruleForm.orders !=null}">
															<span style="font-weight: normal; color: #9e9e9e">〖</span>{{ruleForm.orders}}
														<a
																href="javascript:vopen('/lib/purchase/detail.xt?id=40','purchase40',999,600);"><i
																class="fa fa-folder-open m-l-5" data-toggle="tooltip"
																data-original-title="打开详细页面" data-placement="bottom"></i></a>
															<span style="font-weight: normal; color: #9e9e9e">〗</span>

														</c:if>
													</div>
												</div>
											</div>
											<%-- <div class="col-md-6">
												<div class="form-group ">
													<label class="control-label col-md-4">对应退货单:</label>
													<c:if test="${ruleForm.retorder !=null}">
														<div class="form-control  col-md-8">{{ruleForm.retorder}}</div>
													</c:if>
												</div>
											</div> --%>
										</div>
										<div class="row">
											<div class="col-md-12">
												<div class="form-group ">
													<label class="control-label col-md-2">对应供应商:</label>
													<div class="form-control  col-md-10">

														<c:if test="${ruleForm.suppliers !=null}">
															<span style="font-weight: normal; color: #9e9e9e">〖</span>{{ruleForm.suppliers}}
														<a
																href="javascript:vopen('/xcrm/customer/customer/detail.xt?id=136','customer136',999,600);"><i
																class="fa fa-folder-open m-l-5" data-toggle="tooltip"
																data-original-title="打开详细页面" data-placement="bottom"></i></a>
															<span style="font-weight: normal; color: #9e9e9e">〗</span>
														</c:if>

													</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="col-md-12">
												<div class="form-group no-margin">
													<label class="control-label col-md-2">备注:</label>
													<div class="form-control autogrow col-md-10">{{ruleForm.descin}}</div>
												</div>
											</div>
										</div>
										<!-- 	<div class="row">
											<div class="col-md-12">
												<div class="form-group no-margin">
													<label class="control-label col-md-2">入库明细:</label>
													<div class="form-control autogrow col-md-10"></div>
												</div>
											</div>
										</div> -->
										<!--UTF8-->



									</div>
								</div>
							</div>
							<div class="text-right p-20">
								<button class="btn btn-white waves-effect waves-light"
									onclick='qshow_click_del(52,"libin","77ed22");return false;'>
									<i class="fa fa-trash-o m-r-5"></i>删除
								</button>
								&nbsp;
								<button class="btn btn-white waves-effect waves-light"
									onclick='qshow_click_edit(52,"77ed22");return false;'>
									<i class="fa fa-pencil m-r-5"></i>编辑
								</button>
								&nbsp;
								<!--<span class="button_close_qshow"><button class=" btn btn-default waves-effect waves-light m-r-5" data-dismiss="modal" aria-hidden="true"><i class="fa fa-close m-r-5"></i>关闭</button></span>-->

							</div>
						</div>

						<!--UTF8-->
					</div>
					<p>
						操作提示：点击页面下方的“完成入库”按钮后，入库方可生效。<br> 对于有不同规格的产品，可编辑规格明细
					</p>
					<div id="libitem_in" style="z-index: 0">
						<div class="text-center">
							<div class="pull-right  m-b-5">
								<a class="btn " :href="getOrderHref(ruleForm.did)">编辑明细</a>
							</div>

						</div>
						<form name="frm_libitem" id="frm_libitem"
							action="/lib/in/editlibinact.xt" method="post" target="editfrm"
							novalidate="">
							<div class="bootstrap-table m-t-10">
								<div class="fixed-table-container">
									<table class="table table-bordered table-hover"
										id="location_product">
										<thead>
											<tr>
												<th class="th-inner">序号</th>
												<th class="th-inner">产品名称</th>
												<th class="th-inner text-right">入库量</th>
												<th class="th-inner">备注</th>
												<!--<td>editid</td>-->
												<th class="th-inner">操作</th>
												<th class="th-inner">库位参考</th>
											</tr>
										</thead>
										<tbody>

											<c:forEach items="${CartBoxInAll.map}" var="me"
												varStatus="status">
												<!--完整的一个-->
												<tr>
													<td>${me.goods.gooId}</td>
													<td>${me.goods.gooName}<a
														href="javascript:vopen('/xcrm/market/product/detail.xt?id=100','product100',999,600);"><i
															class="fa fa-folder-open m-l-5" data-toggle="tooltip"
															data-original-title="打开详细页面" data-placement="bottom"></i></a>
													</td>
													<td>
														<div class="text-right">
															<b><div id="tnin">${me.quatity}</div></b>
														</div>
													</td>
													<td>${me.desc}</td>
													<!--<td></td>-->
													<td title="ssss"><a class="doings" href="#"><img
															title="点击编辑本产品的规格明细" align="AbsBottom"
															style="margin: 1px" alt="点击编辑本产品的规格明细"
															src="../images/icons/editdet.png">编辑规格明细</a></td>
													<td style="display: none" title="aaaa"><a
														class="giveItem" href="#"> <img title="点击保存该产品的规格明细"
															align="AbsBottom" style="margin: 1px" alt="点击保存该产品的规格明细"
															src="../images/icons/savedet.png"> 保存规格明细
													</a> <a class="stops" href="#">取消</a></td>

													<td>&nbsp;</td>
												</tr>
												<tr style="display: none" title="第二个">
													<td colspan="5">
														<div>规格明细：</div>
														<div class="bootstrap-table">
															<div class="fixed-table-container">
																<table class="table table-hover table-bordered">
																	<thead>
																		<tr>
																			<th class="th-inner">序号</th>
																			<th class="th-inner">规格</th>
																			<td class="text-right">入库量</td>
																			<th class="th-inner">单位</th>
																			<th class="text-right th-inner">单位换算</th>
																			<th class="th-inner">备注</th>
																		</tr>
																	</thead>
																	<tbody>
																		<tr bgcolor="#ffffff">
																			<td>1 ▲</td>
																			<td>-</td>
																			<td class="text-right "><input name="nin[]"
																				class="nin form-control quatitys" id="nin1"
																				type="text" title="数量" value="${me.quatity}">
																			</td>
																			<td></td>
																			<td class="unit_num text-right">1.000</td>
																			<td><input name="memo[]"
																				class="text-right form-control desctext" type="text"
																				value="${me.desc}"></td>
																			<input name="id[]" type="hidden"
																				class="text-right form-control gidse"
																				value="${me.goods.gooId}">
																			<input name="id[]" type="hidden"
																				class="text-right form-control idse"
																				value="${ingInOid}">
																		</tr>
																	</tbody>
																</table>
															</div>
														</div>
													</td>
												</tr>
												<!-- <tr style="display:none">
												<td colspan="5">
													<a onclick="$('input[name=actiontype]').val(3);$('#frm_libitem').submit();return false;" href="#"><img title="点击保存该产品的规格明细" align="AbsBottom" style="margin:1px" alt="点击保存该产品的规格明细" src="../images/icons/savedet.png">保存规格明细</a>
													<a onclick="libitem_in_click_divcancle();return false;" href="#">取消</a><input type="hidden"></td>
											</tr> -->
												<!--完整的一个-->
											</c:forEach>

											<!-- <tr>
												<td>2</td>
												<td>摄像头-400万半球网络/DS-2CD2F45F(D)-I(W)(S)
													<a href="javascript:vopen('/xcrm/market/product/detail.xt?id=97','product97',999,600);"><i class="fa fa-folder-open m-l-5" data-toggle="tooltip" data-original-title="打开详细页面" data-placement="bottom"></i></a>
												</td>
												<td>
													<div class="text-right"><b>1.000</b></div>
												</td>
												<td>&nbsp;</td>
												<td></td>
												<td>
													<a onclick="libitem_in_click_div(763);return false;" href="#"><img title="点击编辑本产品的规格明细" align="AbsBottom" style="margin:1px" alt="点击编辑本产品的规格明细" src="../images/icons/editdet.png">编辑规格明细</a>
												</td>
												<td>&nbsp;</td>
											</tr> -->

											<input type="hidden">

										</tbody>

									</table>
								</div>
							</div>
						</form>

<c:if test="${fn:length(CartBoxInAll.map)>0}">
						<div class="text-center m-b-10" v-if="ruleForm.intype==3022">
							<a class="btn btn-primary" @click.stop="okinstock(ruleForm.did)"
								target="_BLANK"><i class="ion-ios7-home m-r-5"></i>入库:点此确认入库</a>
						</div>
</c:if>
					</div>

				</div>
			</div>
		</div>
	</div>

	</div>


	<script type="text/javascript">
			var vm = new Vue({
				el: ".createOrderbox",
				data: {
					iframdilog2:"",
					loading: true,
					centerDialogVisible4:false,
					ruleForm: {
						did:"",
						/*主题*/
						titles: "",
						/*仓库*/
						deport: "",
						customertoman: [{
							adid: '选项1',
							adn: '黄金糕'
						}, {
							adid: '选项2',
							adn: '双皮奶'
						}, {
							adid: '选项3',
							adn: '蚵仔煎'
						}, {
							adid: '选项4',
							adn: '龙须面'
						}, {
							adid: '选项5',
							adn: '北京烤鸭'
						}],
						/*填单日期*/
						havetime: "",
						/*状态*/
						types: "",
						/*填单人*/
						domans: "",
						/*库管确认*/
						yesman: "",
						intype:"",
						/*执行时间*/
						dodate: "",
						/*对应采购单*/
						orders: "",
						/*对应退货单*/
						retorder: "",
						/*对应供应商*/
						suppliers: "",
						/*备注*/
						descin: "",
						/*入库明细*/
						indetails: ""
					},
					rules: {
						//数据源model
						titles: [
							//非空验证
							{
								required: true,
								message: '请输入获客主题',
								trigger: 'blur'
							},
							//长度验证
							{
								min: 3,
								max: 5,
								message: '长度在 3 到 5 个字符',
								trigger: 'blur'
							}
						],
						deport: [{
							required: true,
							message: '请选择仓库',
							trigger: 'change'
						}],
						havetime: [
							//数据类型要是date
							{
								type: 'date',
								required: true,
								message: '请选择日期',
								trigger: 'change'
							}
						]
					}

				},
				methods: {
					getOrderHref(val){
						//alert(val);
						return 'instockdetail?oid='+val;
					},okinstock:function(c){
						//确认入库
						/* alert(c+"sadsad"); */
						
							axios.post("/depot/okinstock",
									//参数转换
									Qs.stringify({'id':c}, {
										arrayFormat: 'brackets'
									})		
								).then(function(v) {
									window.location.href="/instockesdetail?ids="+v.data;
									
									 console.info(v.data); 
								}).catch(function(e) {
									alert("出错了"+e);
								});  
					
					}
				},mounted() {
					var sheslfse=${shelfs};
					this.ruleForm.customertoman=sheslfse;
					
					var textInstock=${textInstock};
					//this.iframdilog2="/instockesdilogup0?ids="+textInstock.innum;
					this.ruleForm.did=textInstock.innum;
					this.ruleForm.titles=textInstock.theme;
					this.ruleForm.deport=textInstock.dgsnum;
					if (textInstock.tdate!=null) {
						this.ruleForm.havetime =textInstock.tdate;  
					}
					
					this.ruleForm.types=textInstock.dic_name;
					this.ruleForm.domans=textInstock.use_name;
					if (textInstock.intype==3021) {
						this.ruleForm.yesman="确认完毕";
						centerDialogVisible4=false;
						//alert("querenwanbi");
					}else if (textInstock.intype==3022) {
						centerDialogVisible4=true;
						//alert("ss");
					}
					this.ruleForm.intype=textInstock.intype;
					this.ruleForm.descin=textInstock.indesc;
					this.ruleForm.dodate =textInstock.Idate;  
					
					this.ruleForm.orders=textInstock.theme2;
					this.ruleForm.suppliers=textInstock.supname;
					//this.ruleForm.customertoman=textInstock;
					console.log(textInstock.indesc);
				}

			});
		</script>

</body>
<!--UTF8-->
</html>